<template>
    <view>
        <!-- components/find/index.wxml -->

        <view class="find">
            <view class="find-layer" @tap="goodsDetail($event, { goods_id: item.goods_id })" :data-goods_id="item.goods_id" v-for="(item, index) in findData" :key="index">
                <view class="find-head">
                    <view class="find-head-img"><image :src="item.head_img"></image></view>
                    <view class="find-head-nickname">{{ item.nick_name }}</view>
                </view>

                <view class="find-text">
                    <view class="find-text-content">
                        <view class="find-text-label find-text-newest" v-if="item.label != ''">{{ item.label }}</view>
                        {{ item.text }}
                    </view>
                </view>

                <view class="find-photo">
                    <view class="find-photo-list" v-for="(item1, index1) in item.photo" :key="item1.index1">
                        <image :src="item1"></image>
                    </view>
                </view>

                <view class="find-detail">
                    <view class="find-detail-read">{{ item.read_count }} 已读</view>
                    <view class="find-detail-up">
                        <view class="find-detail-up-img"><image :src="imgUrl + '/imgs/up.png'"></image></view>
                        <view class="find-detail-up-number">{{ item.up_count }}</view>
                    </view>
                    <view class="find-detail-collect">
                        <view class="find-detail-collect-img"><image :src="imgUrl + '/imgs/hot-collect.png'"></image></view>
                        <view class="find-detail-collect-number">{{ item.collect_count }}</view>
                    </view>
                </view>
            </view>
        </view>
        <view class="list-end" v-if="isEnd == 'end'">已经到底啦</view>
    </view>
</template>

<script>
// components/find/index.js
const Config = require('../../config/index.js');

export default {
    data() {
        return {
            imgUrl: Config.imgUrl //图片url
        };
    },
    /**
     * 组件的属性列表
     */
    props: {
        findData: {
            type: Array,
            default: () => []
        },
        //是否加载完成
        isEnd: {
            type: String,
            default: 'start'
        }
    },
    /**
     * 组件的方法列表
     */
    methods: {
        goodsDetail(e, _dataset) {
            
            if (!e.currentTarget) {
                if (_dataSet.tagId) {
                    e.currentTarget = {
                        id: _dataSet.tagId
                    };
                } else {
                    e.currentTarget = {
                        dataset: _dataSet
                    };
                }
            }
            
            // 商品详情
            uni.navigateTo({
                url: '/pages/goodsDetail/index?id=' + e.currentTarget.dataset.goods_id
            });
        }
    }
};
</script>
<style>
@import './index.css';
</style>
